#include "command.h"

void ls(char *buf, int size, const char *path){

    char curr[1024] = { 0 };
    strcpy(curr, path);
    int len = strlen(curr);
    curr[len-1] = '\0';
    printf("%s\n", curr);
    //打开目录流
    DIR *dir = opendir(curr);
    ERROR_CHECK(dir, NULL, "opendir_ls.c");
    struct dirent *dnt;
    //循环获取目录项
    while( (dnt = readdir(dir)) != NULL){
        strcat(buf, dnt->d_name);
        strcat(buf, "  ");
    }
        strcat(buf, "  ");
    

}
